<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('在职人员分析')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<style>
    select {
        padding-top: 3px !important;
    }

    .select-list {
        margin-top: 5px !important;
    }

    .select-list li p {
        width: auto !important;
        margin-top: 7px !important;
    }

    .form-header {
        margin: 10px auto !important;

    }
    .table-striped .table>thead:first-child>tr:first-child>th {
        font-weight: normal;
        font-size: 13px;
        border: 1px solid #cccccc;
        border-right: none;
        border-top: 1px solid #cccccc !important;
    }
</style>
<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="project-form">
                    <div class="col-sm-12">
                        <div class="select-list">
                            <ul>
                                <li>
                                    <p>单位：</p>
                                    <select name="compId" id="compId" class="form-control">
                                        <option value="">请选择</option>
                                        <option th:each="pro:${userComp}" th:value="${pro.compId}"
                                                th:text="${pro.compName}"></option>
                                    </select>
                                </li>
                                <li>
                                    <p>年份：</p>
                                    <select name="years" id="years" class="form-control">
                                        <option value="">请选择</option>
                                        <option value="2020">2020</option>
                                        <option value="2021">2021</option>
                                        <option value="2022">2022</option>
                                        <option value="2023">2023</option>
                                        <option value="2024">2024</option>
                                        <option value="2025">2025</option>
                                    </select>
                                </li>
                                <li>
                                    <p>月份：</p>
                                    <select name="months" id="months" class="form-control">
                                        <option value="">请选择</option>
                                        <option value="1">一月</option>
                                        <option value="2">二月</option>
                                        <option value="3">三月</option>
                                        <option value="4">四月</option>
                                        <option value="5">五月</option>
                                        <option value="6">六月</option>
                                        <option value="7">七月</option>
                                        <option value="8">八月</option>
                                        <option value="9">九月</option>
                                        <option value="10">十月</option>
                                        <option value="11">十一月</option>
                                        <option value="12">十二月</option>
                                    </select>
                                </li>
                                <li>
                                    <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                            class="fa fa-search"></i>&nbsp;搜索</a>
                                    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                            class="fa fa-refresh"></i>&nbsp;重置</a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </form>
            </div>
            <div class="col-sm-12 select-table table-striped">

                <div class="btn-group-sm" id="toolbar" role="group">
                    <a class="btn btn-primary single disabled" onclick="$.operate.edit()">
                        <i class="fa fa-edit"></i> 修改
                    </a>
                    <a class="btn btn-warning" onclick="exportEmpChange()">
                        <i class="fa fa-download"></i> 导出
                    </a>
                </div>
                <table id="empOnJob-table"></table>
                <div class="col-sm-12 sum"></div>
            </div>

        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<script th:inline="javascript">
    var prefix = ctx + "empOnJob";
    var sum;
    $(function () {

        var empOnJob_options = {
            url: prefix + '/list',
            uniqueId: "id",
            id: 'empOnJob-table',
            removeUrl: prefix + "/remove",
            updateUrl: prefix + "/edit/{id}",
            modalName: "在职人员",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            pagination:false,
            rowStyle: function (row, index) {
                var style = {};
                style={css:{'color':'#ed5565','font-weight':'700'}};

                if(row.compName=='合计'){
                    return style;
                }else {
                    return '';
                }

            },
            columns: [
                [{
                    checkbox: true,
                    rowspan: 2,
                    valign:"middle",
                    align: "center",


                },
                    {
                        field: 'compName',
                        title: '工程公司名称',
                        rowspan: 2,
                        valign:"middle",
                        align:"center"
                    },
                    {
                        field: 'months',
                        title: '月份',
                        rowspan: 2,
                        valign:"middle",
                        align:"center"
                    },
                    {
                        field: 'years',
                        title: '年份',
                        rowspan: 2,
                        valign:"middle",
                        align:"center"
                    },
                    {
                        field: 'monthEndNum',
                        title: '月末人数',
                        rowspan: 2,
                        valign:"middle",
                        align:"center"
                    },
                    {
                        field: 'highNum',
                        title: '高层管理',
                        rowspan: 2,
                        valign:"middle",
                        align:"center"
                    },
                    {
                        field: 'highProportion',
                        title: '占比',
                        rowspan: 2,
                        valign:"middle",
                        align:"center"
                    },

                    {
                        field: 'middleNum',
                        title: '中层管理',
                        rowspan: 2,
                        valign:"middle",
                        align:"center"
                    },
                    {
                        field: 'middleProportion',
                        title: '占比',
                        rowspan: 2,
                        valign:"middle",
                        align:"center"
                    },
                    {
                        field: 'basicNum',
                        title: '基层管理',
                        rowspan: 2,
                        valign:"middle",
                        align:"center"
                    },
                    {
                        field: 'basicProportion',
                        title: '占比',
                        rowspan: 2,
                        valign:"middle",
                        align:"center"
                    },
                    {
                        field: 'workerNum',
                        title: '工人',
                        rowspan: 2,
                        valign:"middle",
                        align:"center"
                    },
                    {
                        field: 'workerProportion',
                        title: '占比',
                        rowspan: 2,
                        valign:"middle",
                        align:"center"
                    },
                    {
                        field: 'logisticsNum',
                        title: '后勤(不含安保)',
                        rowspan: 2,
                        valign:"middle",
                        align:"center"
                    },
                    {
                        field: 'logisticsProportion',
                        title: '占比',
                        rowspan: 2,
                        valign:"middle",
                        align:"center"
                    },
                    {
                        title: '性别结构',
                        rowspan: 1,
                        colspan: 2,
                        align:"center"
                    },
                    {
                        title: '工龄分布',
                        rowspan: 1,
                        colspan: 10,
                        align:"center"
                    },
                    {
                        title: '年龄分布',
                        rowspan: 1,
                        colspan: 8,
                        align:"center"
                    },
                    {
                        title: '学历分布',
                        rowspan: 1,
                        colspan: 8,
                        align:"center"
                    },
                    ],
                [

                    {
                        field: 'maleNum',
                        title: '男',
                        align: "center"
                    },
                    {
                        field: 'femaleNum',
                        title: '女',
                        align: "center"
                    },
                    {
                        field: 'oneYearLowerNum',
                        title: '小于1年',
                        align: "center"
                    },
                    {
                        field: 'oneYearLowerProportion',
                        title: '占比',
                        align: "center"
                    },
                    {
                        field: 'oneThreeNum',
                        title: '1年≥~＜3年',
                        align: "center"
                    },
                    {
                        field: 'oneThreeProportion',
                        title: '占比',
                        align: "center"
                    },
                    {
                        field: 'threeFiveNum',
                        title: '3年≥~＜5年',
                        align: "center"
                    },
                    {
                        field: 'threeFiveProportion',
                        title: '占比',
                        align: "center"
                    },
                    {
                        field: 'fiveTenNum',
                        title: '5年≥~＜10年',
                        align: "center"
                    },
                    {
                        field: 'fiveTenProportion',
                        title: '占比',
                        align: "center"
                    },
                    {
                        field: 'tenYearUpperNum',
                        title: '≥10年',
                        align: "center"
                    },
                    {
                        field: 'tenYearUpperProportion',
                        title: '占比',
                        align: "center"
                    },
                    {
                        field: 'twentyThirtyAgeNum',
                        title: '＜30岁',
                        align: "center"
                    },
                    {
                        field: 'twentyThirtyAgeProportion',
                        title: '占比',
                        align: "center"
                    },
                    {
                        field: 'thirtyFortyAgeNum',
                        title: '30岁≥~＜40岁',
                        align: "center"
                    },
                    {
                        field: 'thirtyFortyAgeProportion',
                        title: '占比',
                        align: "center"
                    },
                    {
                        field: 'fortyFiftyAgeNum',
                        title: '40岁≥~＜50岁',
                        align: "center"
                    },
                    {
                        field: 'fortyFiftyAgeProportion',
                        title: '占比',
                        align: "center"
                    },
                    {
                        field: 'fiftyUpperAgeNum',
                        title: '≥50岁',
                        align: "center"
                    },
                    {
                        field: 'fiftyUpperAgeProportion',
                        title: '占比',
                        align: "center"
                    },
                    {
                        field: 'highLowerSchoolNum',
                        title: '高中及以下(含中专)',
                        align: "center"
                    },
                    {
                        field: 'highLowerSchoolProportion',
                        title: '占比',
                        align: "center"
                    },
                    {
                        field: 'juniorCollegeSchoolNum',
                        title: '大专',
                        align: "center"
                    },
                    {
                        field: 'juniorCollegeSchoolProportion',
                        title: '占比',
                        align: "center"
                    },
                    {
                        field: 'undergraduateSchoolNum',
                        title: '本科',
                        align: "center"
                    },
                    {
                        field: 'undergraduateSchoolProportion',
                        title: '占比',
                        align: "center"
                    },
                    {
                        field: 'undergraduateUpperSchoolNum',
                        title: '本科以上',
                        align: "center"
                    },
                    {
                        field: 'undergraduateUpperSchoolProportion',
                        title: '占比',
                        align: "center"
                    },
                ]
            ]

        }

        $.table.init(empOnJob_options);
        //sums();


    })
    // function sums() {
    //     setTimeout(function () {
    //         sum=$("#empOnJob-table").bootstrapTable('getData');
    //         var highNum = 0;//高层管理
    //         var highProportion=0;//占比
    //         var middleNum = 0;//中层管理
    //         var middleProportion=0;//占比
    //         var basicNum = 0;//基层管理
    //         var basicProportion=0;//占比
    //         var workerNum = 0;//工人
    //         var workerProportion=0;//占比
    //         var logisticsNum = 0;//后勤
    //         var logisticsProportion=0;//占比
    //         var maleNum = 0;//男
    //         var femaleNum = 0;//女
    //         var oneYearLowerNum = 0;//1年以下
    //         var oneYearLowerProportion=0;//占比
    //         var oneThreeNum = 0;//1-3年
    //         var oneThreeProportion=0;//占比
    //         var threeFiveNum = 0;//3-5年
    //         var threeFiveProportion=0;//占比
    //         var fiveTenNum = 0;//5-10年
    //         var fiveTenProportion=0;//占比
    //         var tenYearUpperNum = 0;//10年以上
    //         var tenYearUpperProportion=0;//占比
    //         var twentyLowerAgeNum = 0;//20以下
    //         var twentyLowerAgeProportion=0;//占比
    //         var twentyThirtyAgeNum = 0;//20-30
    //         var twentyThirtyAgeProportion=0;//占比
    //         var thirtyFortyAgeNum = 0;//30-40
    //         var thirtyFortyAgeProportion=0;//占比
    //         var fortyFiftyAgeNum = 0;//40-50
    //         var fortyFiftyAgeProportion=0;//占比
    //         var fiftyUpperAgeNum = 0;//50以上
    //         var fiftyUpperAgeProportion=0;//占比
    //         var highLowerSchoolNum = 0;//高中及以下
    //         var highLowerSchoolProportion=0;//占比
    //         var juniorCollegeSchoolNum = 0;//大专
    //         var juniorCollegeSchoolProportion=0;//占比
    //         var undergraduateSchoolNum = 0;//本科
    //         var undergraduateSchoolProportion=0;//占比
    //         var undergraduateUpperSchoolNum = 0;//本科及以上
    //         var undergraduateUpperSchoolProportion=0;//占比
    //         var monthEndNum=0;//月末人数
    //         for (var i in sum) {
    //             highNum += sum[i].highNum;//高层管理
    //             middleNum += sum[i].middleNum;//中层管理
    //             basicNum += sum[i].basicNum;//基层管理
    //             workerNum += sum[i].workerNum;//工人
    //             logisticsNum += sum[i].logisticsNum;//后勤
    //             maleNum += sum[i].maleNum;//男
    //             femaleNum += sum[i].femaleNum;//女
    //             oneYearLowerNum += sum[i].oneYearLowerNum;//1年以下
    //             oneThreeNum += sum[i].oneThreeNum;//1-3年
    //             threeFiveNum += sum[i].threeFiveNum;//3-5年
    //             fiveTenNum += sum[i].fiveTenNum;//5-10年
    //             tenYearUpperNum += sum[i].tenYearUpperNum;//10年以上
    //             twentyLowerAgeNum += sum[i].twentyLowerAgeNum;//20以下
    //             twentyThirtyAgeNum += sum[i].twentyThirtyAgeNum;//20-30
    //             thirtyFortyAgeNum += sum[i].thirtyFortyAgeNum;//30-40
    //             fortyFiftyAgeNum += sum[i].fortyFiftyAgeNum;//40-50
    //             fiftyUpperAgeNum += sum[i].fiftyUpperAgeNum;//50以上
    //             highLowerSchoolNum += sum[i].highLowerSchoolNum;//高中及以下
    //             juniorCollegeSchoolNum += sum[i].juniorCollegeSchoolNum;//大专
    //             undergraduateSchoolNum += sum[i].undergraduateSchoolNum;//本科
    //             undergraduateUpperSchoolNum += sum[i].undergraduateUpperSchoolNum;//本科及以上
    //             monthEndNum+=sum[i].monthEndNum;//月末人数
    //         }
    //         if(sum.length==0){
    //             highProportion=0;
    //             middleProportion=0;
    //             basicProportion=0;
    //             workerProportion=0;
    //             logisticsProportion=0;
    //             oneYearLowerProportion=0;
    //             oneThreeProportion=0;
    //             threeFiveProportion=0;
    //             fiveTenProportion=0;
    //             tenYearUpperProportion=0;
    //             twentyLowerAgeProportion=0;
    //             twentyThirtyAgeProportion=0;
    //             thirtyFortyAgeProportion=0;
    //             fortyFiftyAgeProportion=0;
    //             fiftyUpperAgeProportion=0;
    //             highLowerSchoolProportion=0;
    //             juniorCollegeSchoolProportion=0;
    //             undergraduateSchoolProportion=0;
    //             undergraduateUpperSchoolProportion=0;
    //
    //         }else {
    //             highProportion=(highNum/monthEndNum*100).toFixed(2)+'%';
    //             middleProportion=(middleNum/monthEndNum*100).toFixed(2)+'%';
    //             basicProportion=(basicNum/monthEndNum*100).toFixed(2)+'%';
    //             workerProportion=(workerNum/monthEndNum*100).toFixed(2)+'%';
    //             logisticsProportion=(logisticsNum/monthEndNum*100).toFixed(2)+'%';
    //             oneYearLowerProportion=(oneYearLowerNum/monthEndNum*100).toFixed(2)+'%';
    //             oneThreeProportion=(oneThreeNum/monthEndNum*100).toFixed(2)+'%';
    //             threeFiveProportion=(threeFiveNum/monthEndNum*100).toFixed(2)+'%';
    //             fiveTenProportion=(fiveTenNum/monthEndNum*100).toFixed(2)+'%';
    //             tenYearUpperProportion=(tenYearUpperNum/monthEndNum*100).toFixed(2)+'%';
    //             twentyLowerAgeProportion=(twentyLowerAgeNum/monthEndNum*100).toFixed(2)+'%';
    //             twentyThirtyAgeProportion=(twentyThirtyAgeNum/monthEndNum*100).toFixed(2)+'%';
    //             thirtyFortyAgeProportion=(thirtyFortyAgeNum/monthEndNum*100).toFixed(2)+'%';
    //             fortyFiftyAgeProportion=(fortyFiftyAgeNum/monthEndNum*100).toFixed(2)+'%';
    //             fiftyUpperAgeProportion=(fiftyUpperAgeNum/monthEndNum*100).toFixed(2)+'%';
    //             highLowerSchoolProportion=(highLowerSchoolNum/monthEndNum*100).toFixed(2)+'%';
    //             juniorCollegeSchoolProportion=(juniorCollegeSchoolNum/monthEndNum*100).toFixed(2)+'%';
    //             undergraduateSchoolProportion=(undergraduateSchoolNum/monthEndNum*100).toFixed(2)+'%';
    //             undergraduateUpperSchoolProportion=(undergraduateUpperSchoolNum/monthEndNum*100).toFixed(2)+'%';
    //         }
    //         var html;
    //
    //         html= '<div class="col-sm-12" style="text-align: center;">' + '<h3 style="display: inline;">合计：</h3>' + '<div style="display: inline">' +
    //             "高层管理：" + '<span style="color: red;">' + highNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + highProportion + '</span>' + "；" +
    //             "中层管理：" + '<span style="color: red;">' + middleNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + middleProportion + '</span>' + "；" +
    //             "基层管理：" + '<span style="color: red;">' + basicNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + basicProportion + '</span>' + "；" +
    //             "工人：" + '<span style="color: red;">' + workerNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + workerProportion + '</span>' + "；" +
    //             "后勤：" + '<span style="color: red;">' + logisticsNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + logisticsProportion + '</span>' + "；" +
    //             "男：" + '<span style="color: red;">' + maleNum + '</span>' + "；" +
    //             "女：" + '<span style="color: red;">' + femaleNum + '</span>' + "；" +
    //             "1年以下：" + '<span style="color: red;">' + oneYearLowerNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + oneYearLowerProportion + '</span>' + "；" +
    //             "1-3年：" + '<span style="color: red;">' + oneThreeNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + oneThreeProportion + '</span>' + "；" +'<br>' +
    //             "3-5年：" + '<span style="color: red;">' + threeFiveNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + threeFiveProportion + '</span>' + "；" +
    //             "5-10年：" + '<span style="color: red;">' + fiveTenNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + fiveTenProportion + '</span>' + "；" +
    //             "10年以上：" + '<span style="color: red;">' + tenYearUpperNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + tenYearUpperProportion + '</span>' + "；" +
    //             "20以下：" + '<span style="color: red;">' + twentyLowerAgeNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + twentyLowerAgeProportion + '</span>' + "；" +
    //             "20-30：" + '<span style="color: red;">' + twentyThirtyAgeNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + twentyThirtyAgeProportion + '</span>' + "；" +
    //             "30-40：" + '<span style="color: red;">' + thirtyFortyAgeNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + thirtyFortyAgeProportion + '</span>' + "；" +
    //             "40-50：" + '<span style="color: red;">' + fortyFiftyAgeNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + fortyFiftyAgeProportion + '</span>' + "；" +
    //             "50以上：" + '<span style="color: red;">' + fiftyUpperAgeNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + fiftyUpperAgeProportion + '</span>' + "；" + '<br>' +
    //             "高中及以下：" + '<span style="color: red;">' + highLowerSchoolNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + highLowerSchoolProportion + '</span>' + "；" +
    //             "大专：" + '<span style="color: red;">' + juniorCollegeSchoolNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + juniorCollegeSchoolProportion + '</span>' + "；" +
    //             "本科：" + '<span style="color: red;">' + undergraduateSchoolNum + '</span>' + "；" +
    //             "占比：" + '<span style="color: red;">' + undergraduateSchoolProportion + '</span>' + "；" +
    //             "本科及以上：" + '<span style="color: red;">' + undergraduateUpperSchoolNum + '</span>' + "；"+
    //             "占比：" + '<span style="color: red;">' + undergraduateUpperSchoolProportion + '</span>' + "；"
    //             + '</div>' + '</div>'
    //         $(".sum").empty();
    //         $(".sum").append(html);
    //     },500);
    // }
    function exportEmpChange() {
        $('#empOnJob-table').bootstrapTable('hideColumn', 0);
        $("#empOnJob-table").tableExport({type: 'excel',
            fileName: '在职人员表',
            exportDataType: "all",
        });
        $('#empOnJob-table').bootstrapTable('showColumn', 0);
    }

</script>
</body>
</html>